package util;

import sun.security.util.Debug;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

public class ConfigUtil {
    public static String getPropertiesValueByKey(String filePath, String key) {
        String value = null;
        Properties props = new Properties();
        try {
            String path = ClassLoader.getSystemResource(filePath).getPath();
            props.load(new InputStreamReader(new FileInputStream(path), "UTF-8"));
            value = props.getProperty(key);
        } catch (IOException e) {
            Debug.println("PropertiesUtil", "读取文件失败 " + filePath);
        }
        return value;
    }
}
